package junior.回溯法;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class 回溯算法框架_子集_无重复元素2 {
    static List<List<Integer>> lists = new ArrayList<>();
    static List<Integer> list = new ArrayList<>();
    static int n = 3;
    public static void main(String[] args) {
        lists.add(new ArrayList<>());

        lists.forEach(list -> System.out.println(list.toString()));
    }
    public static List<List<Integer>> combine() {
        dfs(0);
        return lists;
    }
    public static void dfs(int startIndex){
        if(list.size() == n){
            return;
        }
        for(int i = startIndex; i < n ; i++){
            list.add(i+1);

            lists.add(new ArrayList<>(list));
            dfs(i+1);
            list.remove(list.size()-1);
        }
    }
}
